#ifndef _main__h
#define __main_h
//HAL--------------------



//Const--------------------
//base 4ms
#define D_1s         250   //1s
#define D_40ms       10    //40ms
#define D_300ms   75 //300ms
#define D_500ms      125     //500ms
 #define D_1m        60

 
#define  D_MoShi 1
//#define  D_YuYue  4

#define D_Power 4
#define D_up 2
#define D_down 3
 
//Var----------------------
#ifdef  MAIN_C
uint8_t  timer40ms;
uint8_t timer1m;
uint8_t timer1s;
uint8_t  timer500ms;
uint8_t longKeyHoldTime;
uint8_t longKeyValue;
uint8_t holdKey;
uint8_t longKeyJudgeTime;
uint8_t keyValue;
uint8_t startTime;
uint8_t setCurTemp;
uint8_t orderClockOpenHour;
uint8_t orderClockOpenMin;
//uint8_t orderClockCloseHour;
//uint8_t orderClockCloseMin;

uint8_t mainClockHour;
uint8_t mainClockMin;
bit bSecFlash500ms;
bit bUpdateCurTemp;

uint8_t lastsetCurTemp;
uint8_t lastGear;
uint8_t function;
//bit bLowTemp;
bit bError;
bit bError1;
bit bError2;
bit bAdShort;
bit bAdOffBuzz;
uint8_t adShortNum;
bit bAdShortBuzz;
uint8_t adOffBuzzNum;
uint8_t adShortBuzzNum;
bit bHigTemp;
bit bOrderOpen;
bit bOrderClose;
//bit bPeople;
uint8_t lastP_rem;
bit bOpenBuzz;
uint8_t timer300ms;
uint8_t flashSetMode;
uint8_t flashSetYuYue;
bit bMode;
uint8_t modeNum;
bit bPower;
uint8_t powerNum;
uint8_t yuYueNum;
bit bSaveTemp;
//bit bTG;
bit bMode;
bit delaySetPowerH;
uint8_t flashPower;
uint8_t lastBSaveTemp;
bit bOrderOpenNum;
bit lastBorderOpenNum;
bit bKeyYuYueDown;
uint8_t remKeyAdd;
bit bError3;
#else
extern bit bError3;
extern uint8_t remKeyAdd;
extern bit bKeyYuYueDown;
	extern bit lastBorderOpenNum;
	extern bit bOrderOpenNum;
	extern uint8_t lastBSaveTemp;
extern uint8_t flashPower;
extern bit delaySetPowerH;
extern bit bMode;
 extern uint8_t yuYueNum;
extern uint8_t flashSetMode;
extern uint8_t flashSetYuYue;
extern bit bMode;
extern uint8_t modeNum;
extern bit bPower;
extern uint8_t powerNum;
extern bit delaySetPowerH;
extern uint8_t timer1m;
extern uint8_t timer300ms;
//extern bit bPeople;
//extern bit bTG;
extern bit bOpenBuzz;
extern uint8_t lastP_rem;
extern bit bOrderOpen;
extern bit bOrderClose;
extern uint8_t adOffBuzzNum;
extern uint8_t adShortBuzzNum;
extern bit bHigTemp;
extern bit bAdShortBuzz;
extern bit bError;
extern bit bError1;
extern bit bError2;
extern bit bAdShort;
extern bit bAdOffBuzz;
extern uint8_t adShortNum;
extern bit bSaveTemp;
//extern bit bLowTemp;
extern uint8_t function;
extern uint8_t flashsetClock;
extern  uint8_t lastGear;
extern uint8_t setClockNum;
extern uint8_t setFunctionNum;
extern bit bUpdateCurTemp;
extern bit bSecFlash500ms;
extern  uint8_t mainClockHour;
extern uint8_t mainClockMin;
extern uint8_t orderClockOpenHour;
extern uint8_t orderClockOpenMin;
//extern uint8_t orderClockCloseHour;
//extern uint8_t orderClockCloseMin;

extern uint8_t setCurTemp;
//extern bit bPowerOnOff;
//extern uint8_t flashSetClock;
extern uint8_t flashSetFunction;
extern uint8_t startTime;
extern uint8_t keyValue;
extern uint8_t  timer40ms;
extern uint8_t timer1s;
extern	uint8_t  timer500ms;
extern uint8_t longKeyHoldTime;
extern uint8_t longKeyValue;
extern uint8_t holdKey;
extern uint8_t longKeyJudgeTime;
#endif


//Function----------------------
void setPower();
void	remKey();
void OrderOpen();
void PowerSet();
 //void setYuYue();
 void   setMode();
void functionChoice();
void timerControl();
void getKey();
void keyMoShi();
//void keyYuYue();
void keyDangWei();
//void keyPower();
void keyUp();
void keyDown();
void PowerOff();

 void Error();
#endif